<div class="table_machine">
<table>
  <tr>
    <th >Date detection</th>
    <th>Machine</th>
    <th>Type incident</th>
    <th>Date resolution</th>
	<th class="cellbouton"></th>
  </tr>

<% @incidents.each do |incident| %>
<% @machine = Machine.find_by_id(incident.machine_id) %>
  <tr>
    <td>
    	<% if incident.date_detection %>
    		<%=h incident.date_detection.strftime("%d/%m/%Y %H:%M:%S") %>
    	<% end %>
    </td>
    <td>
    	<% if @machine %>
    		<%= link_to @machine.nom_machine, :controller => :incidents, :action => "showByMachine", :id => incident.machine_id%></td>
    	<% end %>
    <td>
    	<% if @typeInc_loc = TypeIncident.find_by_id(incident.type_incident_id) %>
    		<%= link_to @typeInc_loc.libelle, :controller => :incidents, :action => "showByTypeIncident", :id => incident.type_incident_id %>
    	<% end %>
    </td>
    <td>
    	<% if incident.date_resolution %>
    		<%=h incident.date_resolution.strftime("%d/%m/%Y %H:%M:%S") %>
    	<% end %>
    </td>
    <td>
    	<span class="bouton"><%= link_to 'Voir', incident %></span>
    	<span class="delete"><%= link_to 'Supprimer', incident, :confirm => 'Etes-vous sur ?', :method => :delete %></span>
   	</td>
  </tr>
<% end %>
</table>
</div>